package com.yuetong.quotation.service.impl;

import java.util.Date;
import java.util.List;

import com.yuetong.common.utils.DateUtils;
import com.yuetong.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yuetong.quotation.mapper.YtQuotationDemoMapper;
import com.yuetong.quotation.domain.YtQuotationDemo;
import com.yuetong.quotation.service.IYtQuotationDemoService;

/**
 * 报价项模板Service业务层处理
 *
 * @author  卓晓君
 * @date 2025-02-11
 */
@Service
public class YtQuotationDemoServiceImpl implements IYtQuotationDemoService
{
    @Autowired
    private YtQuotationDemoMapper ytQuotationDemoMapper;

    /**
     * 查询报价项模板
     *
     * @param id 报价项模板主键
     * @return 报价项模板
     */
    @Override
    public YtQuotationDemo selectYtQuotationDemoById(Long id)
    {
        return ytQuotationDemoMapper.selectYtQuotationDemoById(id);
    }

    /**
     * 查询报价项模板列表
     *
     * @param ytQuotationDemo 报价项模板
     * @return 报价项模板
     */
    @Override
    public List<YtQuotationDemo> selectYtQuotationDemoList(YtQuotationDemo ytQuotationDemo)
    {
        return ytQuotationDemoMapper.selectYtQuotationDemoList(ytQuotationDemo);
    }

    /**
     * 新增报价项模板
     *
     * @param ytQuotationDemo 报价项模板
     * @return 结果
     */
    @Override
    public int insertYtQuotationDemo(YtQuotationDemo ytQuotationDemo)
    {
        ytQuotationDemo.setCreateTime(DateUtils.getNowDate());
        ytQuotationDemo.setCreatedBy(SecurityUtils.getUsername());
        return ytQuotationDemoMapper.insertYtQuotationDemo(ytQuotationDemo);
    }

    /**
     * 修改报价项模板
     *
     * @param ytQuotationDemo 报价项模板
     * @return 结果
     */
    @Override
    public int updateYtQuotationDemo(YtQuotationDemo ytQuotationDemo)
    {
        ytQuotationDemo.setUpdateTime(DateUtils.getNowDate());
        ytQuotationDemo.setUpdatedBy(SecurityUtils.getUsername());
        return ytQuotationDemoMapper.updateYtQuotationDemo(ytQuotationDemo);
    }

    /**
     * 批量删除报价项模板
     *
     * @param ids 需要删除的报价项模板主键
     * @return 结果
     */
    @Override
    public int deleteYtQuotationDemoByIds(Long[] ids)
    {
        return ytQuotationDemoMapper.deleteYtQuotationDemoByIds(ids);
    }

    /**
     * 删除报价项模板信息
     *
     * @param id 报价项模板主键
     * @return 结果
     */
    @Override
    public int deleteYtQuotationDemoById(Long id)
    {
        return ytQuotationDemoMapper.deleteYtQuotationDemoById(id);
    }
}
